import request from '../utils/request.js'

// 登录接口
function login(username, password, code = '', uuid = '') {
  return request({
    url: '/login',
    method: 'POST',
    data: {
      username,
      password,
      code,
      uuid
    },
    header: {
      isToken: false,
      repeatSubmit: false
    }
  })
}

// 获取用户信息
function getUserInfo() {
  return request({
    url: '/getInfo',
    method: 'GET'
  })
}

// 获取路由信息
function getRouters() {
  return request({
    url: '/getRouters',
    method: 'GET'
  })
}

// 退出登录
function logout() {
  return request({
    url: '/logout',
    method: 'POST'
  })
}

// 获取验证码
function getCaptcha() {
  return request({
    url: '/captchaImage',
    method: 'GET'
  })
}

// 注册用户
function register(data) {
  return request({
    url: '/register',
    method: 'POST',
    data
  })
}

export {
  login,
  getUserInfo,
  getRouters,
  logout,
  getCaptcha,
  register
}
